<template>
    <div>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/' }">我的工作平台 </el-breadcrumb-item>
        <el-breadcrumb-item><a href="/">代办列表</a></el-breadcrumb-item>
      </el-breadcrumb>
      <el-table :data="tableDate" >
      <el-table-column prop="type" label="代办任务类型" width="180"></el-table-column>
      <el-table-column prop="name" label="代办任务名称" width="180"></el-table-column>
      <el-table-column prop="time" label="到达时间"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button @click="showRenWu(scope.row)">查看</el-button>
          <el-button @click="chuLi(scope.row)">处理</el-button>
        </template>
      </el-table-column>
      </el-table>
      <el-dialog title="查看代办事宜" width="50%" :visible="visible" @close="visible=false">
        <el-form >
         <el-form-item label="任务编号" label-width="80px">
           <el-input v-model="RenWu.no" disabled></el-input>
         </el-form-item >
         <el-form-item label="任务名称" label-width="80px">
           <el-input v-model="RenWu.name" disabled></el-input>
         </el-form-item>
         <el-form-item label="巡检路线" label-width="80px">
           <el-input v-model="RenWu.xianlu" disabled></el-input>
         </el-form-item>
         <el-form-item label="起始杆号" label-width="80px">
           <el-input v-model="RenWu.start" disabled></el-input>
         </el-form-item>
         <el-form-item label="终止杆号" label-width="80px">
           <el-input v-model="RenWu.stop" disabled></el-input>
         </el-form-item>
         <el-form-item label="下发人" label-width="80px">
           <el-input v-model="RenWu.userName" disabled></el-input>
         </el-form-item>
         <el-form-item label="下发时间" label-width="80px">
           <el-input v-model="RenWu.time" disabled></el-input>
         </el-form-item>
         <el-form-item label="备注" label-width="80px">
           <el-input v-model="RenWu.bz" disabled></el-input>
         </el-form-item>
        </el-form>

      	<template slot="footer">
      		<el-button type="primary" @click="closeMe">确定</el-button>
      		<el-button type="info" @click="visible=false">取消</el-button>
      	</template>
      </el-dialog>
    </div>
</template>

<script>
  import axios from 'axios'
  export default{
    data(){
    return{
     tableDate:[],
     visible:false,
     RenWu:[]
    }
    }
    ,methods:{
      showRenWu:function(row){
        var self=this
        console.log(row.id)
        axios.post("http://localhost:8081/dianlixunjian/getRenWu",row.id)
        .then(function(d){
          self.RenWu=d.data
        }).catch(function(v){
          console.log(v)
        })
        this.visible=true
      },
      closeMe:function(){
        this.visible=false
      },
      chuLi:function(row){
        var self=this
        console.log(row.id)
        axios.post("http://localhost:8081/dianlixunjian/getQueXian",row.id)
        .then(function(d){
          self.RenWu=d.data
          console.log(self.RenWu)
          let s=JSON.stringify(self.RenWu)
          console.log(s)
          self.$router.push({path:'/dengji2',query:{Renwu:s}})
        }).catch(function(v){
          console.log(v)
        })
      }
    },
    created:function(){
     var self=this
     axios.get("http://localhost:8081/dianlixunjian/getDaiBan")
     .then(function(d){
       self.tableDate=d.data
       console.log(d.data.time)
     }).catch(function(v){
       console.log(v)
     })
    }
  }
</script>

<style scoped="scoped">
  .el-table{
   width: 900px;
   margin-top: 60px;
   margin-left: 100px;
   text-align: middle;
  }

</style>
